/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Util;

import java.io.File;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Node;

/**
 *
 * @author DatPLT
 */
public class TransformerUtil {


    public static void writeXML(Node node, String filePath) {
        try {
            TransformerFactory tff = TransformerFactory.newInstance();
            Transformer tran = tff.newTransformer();
            tran.setOutputProperty(OutputKeys.INDENT, "yes");
            DOMSource source = new DOMSource(node);
            StreamResult result = new StreamResult(new File(filePath));
            tran.transform(source, result);
        } catch (Exception e) {
            
        }
    }
}
